# Contributor: Kevin Daudt <kdaudt@alpinelinux.org>
# Maintainer: Kevin Daudt <kdaudt@alpinelinux.org>
pkgname=py3-geoip2
pkgver=4.7.0
pkgrel=0
pkgdesc="API for the GeoIP2 web services and databases"
options="!check" # Requires unpackaged mocket
url="https://www.maxmind.com/en/home"
arch="noarch"
license="Apache-2.0"
depends="py3-requests py3-maxminddb py3-aiohttp py3-urllib3"
makedepends="python3-dev libmaxminddb-dev py3-setuptools"
checkdepends="py3-nose py3-mock"
_test_data_commit=2b37923df61aa3b5fb6c7edfbf4dc5fafa10258a
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/maxmind/GeoIP2-python/archive/v$pkgver.tar.gz
	MaxMind-DB-test-data-$_test_data_commit.tar.gz::https://github.com/maxmind/MaxMind-DB/archive/$_test_data_commit.tar.gz"
builddir="$srcdir/GeoIP2-python-$pkgver"

prepare() {
	cd "$srcdir"

	# Submodule required for tests
	cp -r "MaxMind-DB-$_test_data_commit/" -T "$builddir/tests/data"
	default_prepare
}

build() {
	python3 setup.py build
}

check() {
	python3 setup.py test
}

package() {
	python3 setup.py install --skip-build --root="$pkgdir"
}

sha512sums="
eebcf56dca3cd245379948a5e53d9518761c08ae5c88ab090f118fbf72161111c78172842f9fcbb56f1411e57977b14d13b84c3a35cc339d2d261a578eb24617  py3-geoip2-4.7.0.tar.gz
a192a9fec623ffb84e369289292bf4a87d91e9a604494583f3bff293eeed56ca1bc1e8db3f89dbccddafe8b35a1d0340ac754998a2c84f6e4d70dfc4d4c7aa1d  MaxMind-DB-test-data-2b37923df61aa3b5fb6c7edfbf4dc5fafa10258a.tar.gz
"
